package com.chengww.grab_rp.database.plugin

import androidx.lifecycle.LiveData
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query

/**
 * Created by chengww on 2/20/21
 * @author chengww
 */
@Dao
interface PluginDao {
    @Query("SELECT * FROM plugin_data WHERE id = :id")
    fun getData(id: Int): PluginData?

    @Query("SELECT * FROM plugin_data WHERE id = :id")
    fun getDataLive(id: Int): LiveData<PluginData?>

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(pluginData: PluginData)

    @Query("DELETE FROM plugin_data")
    fun deleteAll()

    @Query("DELETE FROM plugin_data where id = :id")
    fun delete(id: Int)

}